package com.whq.thrift.api.web.admin.db.test;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

public interface IceTestMapper {
	
	@SelectProvider(type = IceTestSqlProvider.class, method = "getIceTestCaseByMapSql")
	@Results(value = { @Result(property = "id", column = "id"),
			@Result(property = "name", column = "name"),
			@Result(property = "method", column = "method"),
			@Result(property = "ip", column = "ip"), 
			@Result(property = "port", column = "port"),
			@Result(property = "ctxJson", column = "ctx_json"), 
			@Result(property = "paramJson", column = "param_json"),
			@Result(property = "manager", column = "manager"), 
			@Result(property = "updateTime", column = "update_time"),
			@Result(property = "createTime", column = "create_time") })
	public List<IceTest> findIceTestByMap(Map<String, Object> whereParams);

	@Select("select * from t_ice_test_case")
	@Results(value = { @Result(property = "id", column = "id"), 
			@Result(property = "name", column = "name"),
			@Result(property = "method", column = "method"),
			@Result(property = "ip", column = "ip"), 
			@Result(property = "port", column = "port"),
			@Result(property = "ctxJson", column = "ctx_json"), 
			@Result(property = "paramJson", column = "param_json"),
			@Result(property = "manager", column = "manager"), 
			@Result(property = "updateTime", column = "update_time"),
			@Result(property = "createTime", column = "create_time") })
	public List<IceTest> findAllIceTestInfo();
	
	@Insert("INSERT INTO t_ice_test_case " + " (id, name, "
			+ "method, ip, port,ctx_json,param_json,"
			+ "manager,update_time,create_time) " + " VALUES "
			+ " (#{id}, #{name}, #{method}, #{ip}, #{port},#{ctxJson},#{paramJson},"
			+ "#{manager},#{updateTime},#{createTime})")
	public int addIceTest(IceTest iceTest);
	
	@Delete("delete from t_ice_test_case where id=#{id}")
	public int delIceTest(@Param("id") Integer id);
	
	@Select("select * from t_ice_test_case where id=#{id}")
	@Results(value = { @Result(property = "id", column = "id"),
			@Result(property = "name", column = "name"),
			@Result(property = "method", column = "method"),
			@Result(property = "ip", column = "ip"), 
			@Result(property = "port", column = "port"),
			@Result(property = "ctxJson", column = "ctx_json"), 
			@Result(property = "paramJson", column = "param_json"),
			@Result(property = "manager", column = "manager"),
			@Result(property = "updateTime", column = "update_time"),
			@Result(property = "createTime", column = "create_time") })
	public IceTest getIceTestById(@Param("id") int id);
	
	@SelectProvider(type = IceTestSqlProvider.class, method = "getSelectCountSql")
	public int findIceTestCount(Map<String, Object> whereParams);
}
